extends ../layout

append css
  link(rel='stylesheet', href='/components/sweetalert2/dist/sweetalert2.css')
  link(rel='stylesheet', href='/css/blog.css')

append beforjs
  script(type="text/javascript", src='/components/sweetalert2/dist/sweetalert2.min.js')
    
block main
  .bg(style='background-color:#EEEEEE;')
    block header
      // Static navbar
      nav.navbar.navbar-default.navbar-static-top.cnav(style='margin-bottom:0;')
        .container
          .navbar-header
            button.navbar-toggle.collapsed(type='button', data-toggle='collapse', data-target='#navbar', aria-expanded='false', aria-controls='navbar')
              span.sr-only Toggle navigation
              span.icon-bar
              span.icon-bar
              span.icon-bar
            a.navbar-brand(href='/') SKY-Blog
          #navbar.navbar-collapse.collapse
            ul.nav.navbar-nav
              li
                a(href='/') 博客首页
              li
                form.navbar-form.navbar-left(role="search", style='')
                  .input-group
                    -if(filter)
                      -var key_word = filter.keyword;
                    -else
                      -var key_word = '';
                    input.form-control.searcKkeyword(type="text", placeholder="搜文章名、相关内容...", value=key_word)
                    span.input-group-btn
                      button.btn.btn-default(type="button" onclick='submitKeyword()')
                        i.fa.fa-search
                      script(type="text/javascript").
                        function submitKeyword(){
                          var keyword = $('.searcKkeyword').val();
                          window.location.replace('/articles?keyword='+keyword);
                        }    
            ul.nav.navbar-nav.navbar-right
              //-登录注册
              if(!user) 
                li
                  a(href='/user/login') 登录
                li
                  a(href='/user/register') 注册
              else 
                li.dropdown
                  a.dropdown-toggle(href='#', data-toggle='dropdown', role='button', aria-haspopup='true', aria-expanded='false')
                    | 个人信息
                    span.caret
                  ul.dropdown-menu
                    li
                      a(href='/articles/add') 写博客
                    li
                      a(href='#') 我的博客
                    li.divider(role='separator')
                    li.dropdown-header 
                      span#usernameID(style='color:#fff;')
                        h4=user.username
                    li
                      a(href='/admin') 个人设置
                    li
                      a(href='/user/login/out') 注销

          // /.nav-collapse
    block contentAll
    .container(style='padding:0;')
      .row
        .col-sm-9.contentLeft(style='padding:0;')
          block contentLeft
        .col-sm-3.contentRight
          block contentRight


  block footer
    footer.footer.navbar-static-bottom(style='background-color:#FFF;text-align:center; font-color:#FFF;')
      hr.footerhr
      .container
        p.text-muted © CopyRight 2018.03-2018.04, XZQ Inc.All Rights Reserved.
        p.text-muted 联系我们：QQ : 252161732, Address : 南宁学院 
        p.text-muted 基于mongodb大型技术博客分享论坛的设计

  



